home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / tex / cs_tex_4 / cstex4_2.zoo / tugboat.lzh / STYLES / TUGBOAT / TUGBOAT.STY (.txt) < prev   
Texinfo Document  |  1990-06-11  |  68KB  |  1,677 lines

  1. % TUGBOAT.STY
  2. % Version 1.06
  3. % 13 May 1990
  4. \def\thistubstyle{plain}
  5. % general items
  6. \def\makeatletter{\catcode`\@=11 }
  7. \makeatletter           % used, as in PLAIN, in protected control sequences
  8. %  stop reading this file if it's been loaded already
  9. \ifx\tugstyloaded@\thistubstyle\makeatother\initializearticle
  10.  \endinput\else\let\tugstyloaded@\thistubstyle\fi
  11. \input tugboat.com      % macros common to tugboat.sty and
  12.                         % ltugboat.sty (latex style file)
  13. %  some things with the same names as in, or reiterated from, AMS-TeX
  14. \def\document{}                % override an AMS-TeX convention
  15. \output{\output@}
  16. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  17. %  Directory.
  18. %  **  fonts
  19. %  **  page dimensions
  20. %  **  headers/footers
  21. %  **  page adjustment
  22. %  **  output
  23. %  **  general mechanism for tags
  24. %  **  titles, authors, addresses
  25. %  **  heads
  26. %  **  text and subtext
  27. %  **  lists
  28. %  **  verbatim
  29. %  **  figures
  30. %  **  utilities
  31. %  **  initialization
  32. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  33. %                                                                            
  34. %     *****  fonts  *****
  35. %                                                                            
  36. %  Struts give ascenders and descenders to assist in baseline alignment
  37. %  (e.g. of adjoining vertical boxes); useful only with text fonts.
  38. %  \strut is defined in PLAIN .  The structure of \strutt is equivalent.
  39. \newbox\struttbox
  40. \def\strutt{\relax\ifmmode\copy\struttbox\else\unhcopy\struttbox\fi}
  41. %  Struts are given the following dimensions for use in TUGboat:
  42. %  \strut = height/depth of parenthesis in current font
  43. %           (not the same as PLAIN)
  44. %  \strutt height + depth = \normalbaselineskip,
  45. %           height = same as \strut
  46. %           (equivalent to PLAIN \strut )
  47. %  The fonts below are sufficient for most ordinary TUGboat production.
  48. %  Additional titling fonts are defined elsewhere, and occasionally an
  49. %  extra font will be needed for a particular item (e.g. the device
  50. %  charts) and defined in that file.
  51. %  All PLAIN CM fonts.
  52. \font\tenrm=cmr10
  53. \font\ninerm=cmr9
  54. \font\eightrm=cmr8
  55. \font\sevenrm=cmr7
  56. \font\sixrm=cmr6
  57. \font\fiverm=cmr5
  58. \font\teni=cmmi10 \skewchar\teni='177
  59. \font\ninei=cmmi9 \skewchar\ninei='177
  60. \font\eighti=cmmi8 \skewchar\eighti='177
  61. \font\seveni=cmmi7 \skewchar\seveni='177
  62. \font\sixi=cmmi6 \skewchar\sixi='177
  63. \font\fivei=cmmi5 \skewchar\fivei='177
  64. \font\tensy=cmsy10 \skewchar\tensy='60
  65. \font\ninesy=cmsy9 \skewchar\ninesy='60
  66. \font\eightsy=cmsy8 \skewchar\eightsy='60
  67. \font\sevensy=cmsy7 \skewchar\sevensy='60
  68. \font\sixsy=cmsy6 \skewchar\sixsy='60
  69. \font\fivesy=cmsy5 \skewchar\fivesy='60
  70. \font\tenex=cmex10
  71. \font\tenbf=cmbx10
  72. \font\ninebf=cmbx9
  73. \font\eightbf=cmbx8
  74. \font\sevenbf=cmbx7
  75. \font\sixbf=cmbx6
  76. \font\fivebf=cmbx5
  77. \font\tentt=cmtt10
  78. \font\ninett=cmtt9
  79. \font\eighttt=cmtt8
  80. \font\tensl=cmsl10
  81. \font\ninesl=cmsl9
  82. \font\eightsl=cmsl8
  83. \font\sevensl=cmti7             %  Would use cmsl7 if it were standard.
  84.                                 %  Currently needed only for \def of \LaTeX
  85. \font\tenit=cmti10
  86. \font\nineit=cmti9
  87. \font\eightit=cmti8
  88. \font\sevenit=cmti7
  89. \font\tenuit=cmu10 
  90. \font\tensmc=cmcsc10
  91. \font\ninesmc=cmcsc10           % redefine if cmcsc9 and/or cmcsc8 exist
  92. \font\eightsmc=cmcsc10
  93. \font\tentex=cmtex10            % for ASCII character set
  94. \def\mit{\fam\@ne}              % from plain
  95. \def\cal{\fam\tw@}              % from plain
  96. \def\sy{\cal}
  97. %  cmss fonts are not needed all the time.  Permit as-needed access.
  98. \def\LoadSansFonts{%
  99.   \global\font\twelvess=cmss10 scaled \magstep1
  100.   \global\font\tenss=cmss10
  101.   \global\font\niness=cmss9
  102.   \global\font\eightss=cmss8
  103.   \addto\tenpoint{\def\ssf{\tenss}}
  104.   \addto\ninepoint{\def\ssf{\niness}}
  105.   \addto\eightpoint{\def\ssf{\eightss}}
  106.   \gdef\LoadSansFonts{}}
  107. %  TUGboat section heads
  108. \font \seventeenssb=cmssbx10 scaled \magstep3
  109. \font \twelvessb=cmssbx10 scaled \magstep1
  110. \newfam\sectitlefam
  111. \textfont\sectitlefam=\seventeenssb \scriptfont\sectitlefam=\twelvessb
  112. %  \stbaselineskip set in tugboat.com
  113. \def\sectitlefont{%
  114.   \fam\sectitlefam \seventeenssb \baselineskip=\stbaselineskip }
  115. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  116. %     *****  Definitions of \tenpoint, \ninepoint, etc.  *****
  117. %  Following is a facility for adding commands to \tenpoint, \ninepoint
  118. %  and \eightpoint.  \LoadSansFonts uses this technique above.
  119. %  Also used to add math families, as with:
  120. %       \addto\tenpoint{\textfont\frakfam...}
  121. %  to add a Fraktur family.
  122. \def\addto#1#2{%
  123.   \csname @addsto\string#1\endcsname=
  124.   \expandafter{\the\csname @addsto\string#1\endcsname#2}}
  125. \def\@additionsto#1{\expandafter\the\csname @addsto\string#1\endcsname}
  126. \expandafter\newtoks\csname @addsto\string\tenpoint\endcsname
  127. \expandafter\newtoks\csname @addsto\string\ninepoint\endcsname
  128. \expandafter\newtoks\csname @addsto\string\eightpoint\endcsname
  129. \newskip\ttglue
  130. \def\setttglue{%
  131.   \edef\@thefont{\the\font}%  to restore this font after the setting
  132.   \tt \ttglue=.5em plus .25em minus .15em
  133.   \@thefont}
  134. %  We assume that \scriptscriptfonts remain the same throughout
  135. \scriptscriptfont\z@=\fiverm
  136. \scriptscriptfont\@ne=\fivei
  137. \scriptscriptfont\tw@=\fivesy
  138. \scriptscriptfont\thr@@=\tenex
  139. \scriptscriptfont\bffam=\sixbf
  140. \newdimen\normaltenpointstretch    \normaltenpointstretch=1.6667pt
  141. \def\NormalTenPointSpacing{\AdjustNormalSpacing\tenpoint{}}
  142. \def\StretchyTenPointSpacing{\AdjustNormalSpacing\tenpoint{2.4}}
  143. \def\tenpoint{%
  144.   \normalbaselineskip=12pt
  145.   \abovedisplayskip=3pt plus 3pt minus 1pt
  146.   \belowdisplayskip=3pt plus 3pt minus 1pt
  147.   \abovedisplayshortskip=0pt plus 3pt
  148.   \belowdisplayshortskip=1pt plus 3pt minus 1pt
  149.   \def\rm{\fam\z@\tenrm}%
  150.   \textfont\z@=\tenrm \scriptfont\z@=\sevenrm
  151.   \def\oldstyle{\fam\@ne\teni}%
  152.   \textfont\@ne=\teni \scriptfont\@ne=\seveni
  153.   \textfont\tw@=\tensy \scriptfont\tw@=\sevensy
  154.   \textfont\thr@@=\tenex \scriptfont\thr@@=\tenex
  155.   \def\it{\fam\itfam\tenit}%
  156.   \textfont\itfam=\tenit \scriptfont\itfam=\sevenit
  157.   \def\sl{\fam\slfam\tensl}%
  158.   \textfont\slfam=\tensl \scriptfont\slfam=\sevensl
  159.   \def\bf{\fam\bffam\tenbf}%
  160.   \textfont\bffam=\tenbf \scriptfont\bffam=\eightbf
  161.   \def\smc{\tensmc}%
  162.   \def\SMC{\ninesmc}%
  163.   \def\tt{\tentt}%
  164.   \setttglue
  165.   \def\upright{\tenuit}%
  166.   \setbox\strutbox=\hbox{\vrule height7.5pt depth2.5pt width\z@}%
  167.   \setbox\struttbox=\hbox{\vrule height8.5pt depth3.5pt width\z@}%
  168.   \normalbaselines \rm
  169.   \@additionsto\tenpoint}
  170. \tenpoint                       % initialize -- default font
  171. \newdimen\normalninepointstretch   \normalninepointstretch=1.5pt
  172. \def\NormalNinePointSpacing{\AdjustNormalSpacing\ninepoint{}}
  173. \def\StretchyNinePointSpacing{\AdjustNormalSpacing\ninepoint{2.4}}
  174. \def\ninepoint{\normalbaselineskip=11pt
  175.   \abovedisplayskip=2.5pt plus 2.5pt minus 1pt
  176.   \belowdisplayskip=2.5pt plus 2.5pt minus 1pt
  177.   \abovedisplayshortskip=0pt plus 2.5pt
  178.   \belowdisplayshortskip=1pt plus 2.5pt minus 1pt
  179.   \def\rm{\fam\z@\ninerm}%
  180.   \textfont\z@=\ninerm \scriptfont\z@=\sevenrm
  181.   \def\oldstyle{\fam\@ne\ninei}%
  182.   \textfont\@ne=\ninei \scriptfont\@ne=\seveni
  183.   \textfont\tw@=\ninesy \scriptfont\tw@=\sevensy
  184.   \def\it{\fam\itfam\nineit}%
  185.   \textfont\itfam=\nineit
  186.   \def\sl{\fam\slfam\ninesl}%
  187.   \textfont\slfam=\ninesl
  188.   \def\bf{\fam\bffam\ninebf}%
  189.   \textfont\bffam=\ninebf \scriptfont\bffam=\sevenbf
  190.   \def\smc{\ninesmc}%
  191.   \def\tt{\ninett}%
  192.         \setttglue
  193.   \setbox\strutbox=\hbox{\vrule height 6.75pt depth 2.25pt width\z@}%
  194.   \setbox\struttbox=\hbox{\vrule height 7.75pt depth 3.25pt width\z@}%
  195.   \normalbaselines \rm
  196.   \@additionsto\ninepoint }
  197. %  The following setting can be used when baselineskip = 10pt
  198. %  \setbox\struttbox=\hbox{\vrule height 7.25pt depth 2.75pt width\z@}%
  199. \newdimen\normaleightpointstretch  \normaleightpointstretch=1.333pt
  200. \def\NormalEightPointSpacing{\AdjustNormalSpacing\eightpoint{}}
  201. \def\StretchyEightPointSpacing{\AdjustNormalSpacing\eightpoint{2.25}}
  202. \def\eightpoint{\normalbaselineskip=10pt
  203.   \abovedisplayskip=2pt plus 2pt minus 1pt
  204.   \belowdisplayskip=2pt plus 2pt minus 1pt
  205.   \abovedisplayshortskip=0pt plus 2pt
  206.   \belowdisplayshortskip=1pt plus 2pt minus 1pt
  207.   \def\rm{\fam\z@\eightrm}%
  208.   \textfont\z@=\eightrm \scriptfont\z@=\sixrm
  209.   \def\oldstyle{\fam\@ne\eighti}%
  210.   \textfont\@ne=\eighti \scriptfont\@ne=\sixi
  211.   \textfont\tw@=\eightsy \scriptfont\tw@=\sixsy
  212. % \textfont\thr@@=\eightex \scriptfont\thr@@=\eightex
  213.   \def\it{\fam\itfam\eightit}%
  214.   \textfont\itfam=\eightit
  215.   \def\sl{\fam\slfam\eightsl}%
  216.   \textfont\slfam=\eightsl
  217.   \def\bf{\fam\bffam\eightbf}%
  218.   \textfont\bffam=\eightbf \scriptfont\bffam=\sixbf
  219.   \def\smc{\eightsmc}%
  220.   \def\tt{\eighttt}%
  221.   \setttglue
  222.   \setbox\strutbox=\hbox{\vrule height 6pt depth 2pt width\z@}%
  223.   \setbox\struttbox=\hbox{\vrule height 7pt depth 3pt width\z@}%
  224.   \normalbaselines \rm
  225.   \@additionsto\eightpoint }
  226. %  The 8pt cap/small cap font is not loaded.  See a corresponding remark
  227. %  above for the 9pt csc font.
  228. %  this is equivalent to baselineskip = 9pt
  229. %  \setbox\struttbox=\hbox{\vrule height 6.5pt depth 2.5pt width\z@}%
  230. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  231. %  Following will allow text to be a bit stretchier than the built-in
  232. %  setting; TeXbook, page 433, 355
  233. \def\@setstretch{\fontdimen3\the\font=}
  234. \def\AdjustNormalSpacing#1#2{%  #1=pointsize, #2=adjustment factor
  235.   {\T@stDimen=#2\csname normal\expandafter\gobble\string#1stretch\endcsname
  236.   #1%
  237.   \rm\@setstretch\T@stDimen
  238.   \it\@setstretch\T@stDimen
  239.   \bf\@setstretch\T@stDimen
  240. %  Anticipated changes to this font handling scheme:
  241. %  Dynamic loading of fonts, probably in groups according to size
  242. %  Removal of \rm, \bf, etc., from \*point expansions, replacement
  243. %    by generic \rm, \bf, etc. definitions
  244. %  Mechanism for switching neatly between serif and sans-serif
  245. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  246. %                                                                             
  247. %     *****  page dimensions  *****
  248. %                                                                             
  249. %  vertical dimensions
  250. \newdimen\trimlgt       \trimlgt=11in           % 10.5in (vols 7-9)
  251. \newdimen\headmargin    \headmargin=3.5pc       % 2.5pc  (vols 7-9)
  252. \newdimen\pagelgt
  253. \newdimen\rheadlgt      \rheadlgt=2.5pc         % + headmargin = 6pc = 1in
  254. \newdimen\toplgt        \toplgt=\z@
  255. \newdimen\normalcollgt  \normalcollgt=54pc      % 52pc for 5#2
  256. \newdimen\collgt        \collgt=\normalcollgt
  257. \newdimen\Collgt
  258. \maxdepth=2pt
  259. \newdimen\botlgt        \botlgt=\z@
  260. \newdimen\rfootlgt      \rfootlgt=2pc
  261. \newif\ifThisIsFirstPage        \ThisIsFirstPagefalse
  262. \def\resetpagelgt{%
  263.   \pagelgt=\collgt \Collgt=\collgt
  264.   \advance\pagelgt by \rheadlgt
  265.   \ifThisIsFirstPage \advance\Collgt by-\toplgt
  266.                      \advance\Collgt by-\botlgt \fi
  267.   \advance\pagelgt by \maxdepth
  268.   \global\advance\pagelgt by \rfootlgt
  269.   \global\vsize=\Collgt }
  270. \def\resetfpagelgt{%
  271.   \global\ThisIsFirstPagetrue
  272.   \resetpagelgt }                 % exclude special first page material
  273. \resetpagelgt
  274. \raggedbottom
  275. %  horizontal dimensions
  276. \newdimen\colwd
  277. \newdimen\intercolwd    \intercolwd=\z@
  278. \newdimen\pagewd        \pagewd=39pc
  279. \newdimen\trimwd        \trimwd=\pagewd
  280. \newdimen\oddleftindent \oddleftindent\z@
  281. \newdimen\evenleftindent \evenleftindent\z@
  282. \def\onecol{\colwd=\pagewd            \OneCol }
  283. \newdimen\onenarrowcolwd        \onenarrowcolwd=30pc
  284. \def\onenarrow{\colwd=\onenarrowcolwd \OneCol }
  285. %       before 5#2, `narrow' was 34pc
  286. \newdimen\onemediumcolwd        \onemediumcolwd=34pc
  287. \def\onemedium{\colwd=\onemediumcolwd  \OneCol }
  288. \newdimen\twocolcolwd           \twocolcolwd=18.75pc
  289. \def\twocol{\colwd=\twocolcolwd \intercolwd=1.5pc \TwoCol }
  290. \newdimen\threecolcolwd         \threecolcolwd=12pc
  291. \def\threecol{\colwd=\threecolcolwd \intercolwd=1.5pc \ThreeCol }
  292. \def\CenterOneCol{%
  293.   \oddleftindent\pagewd
  294.   \advance\oddleftindent -\colwd
  295.   \divide\oddleftindent\tw@
  296.   \evenleftindent\oddleftindent
  297.   \coloffset\ifodd\pageno\oddleftindent\else\evenleftindent\fi
  298. \def\OneCol{\hsize=\colwd \CenterOneCol \numcols=1 \resetmaxcols}
  299. \def\TwoCol{\hsize=\colwd \numcols=2 \resetmaxcols}
  300. \def\ThreeCol{\hsize=\colwd \numcols=3 \resetmaxcols}
  301. \def\resetmaxcols{%
  302.   \ifnum\numcols>\maxcols
  303.     \ifOverlaysinTeX \maxcols=\numcols
  304.     \else \immediate\write\sixt@@n{%
  305.       The new setting of \string\numcols is greater than \string\maxcols.^^J
  306.       Either allow overlays in TeX or increase \string\maxcols.}\fi
  307.   \fi}
  308. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  309. %                                                                            
  310. %     *****  headers/footers  *****
  311. %                                                                            
  312. \def\pagenoprefix{}
  313. \def\rtitlex{\def\tubfont{\tenpoint\rm}\TUB, \volx }
  314. \def\rtitle{%
  315.   \hbox to \pagewd{%
  316.     \tenrm
  317.     \makestrut[10pt;\z@]%
  318.     \ifodd\pageno \rtitlex\qquad\midrtitle\hfil\pagenoprefix\number\pageno
  319.     \else \pagenoprefix\number\pageno\hfil\midrtitle\qquad\rtitlex \fi
  320.     }%
  321. \def\runhead{\vbox to \rheadlgt{\rtitle \vfil }}
  322. \def\rfoot{%
  323.   \hbox to \pagewd{%
  324.     \tenrm
  325.     \makestrut[\z@;0.5pc]%
  326.     \midrtitle\hfil\midrtitle
  327.     }%
  328. \def\runfoot{\vbox to \rfootlgt{\vfil \rfoot }}
  329. %  Macros to produce extra running heads for stripping onto pages
  330. %  received as camera copy.  Format must be preset to \OneCol, and
  331. %  start on a new page.
  332. %  Generate 5 (4 + normal running head) per page.
  333. \def\DrawT@pLines{%
  334.   \vskip\topskip
  335.   \ulap{%
  336.     \line{%
  337.       \raise 1ex\rlap{\leaders\hrule\hskip\pagewd}%
  338.       \leaders\hrule\hfill
  339.       }}
  340.   \medskip}
  341. \def\r@nhead{%
  342.   \vbox to .23\vsize{%
  343.     \basezero \hsize=\pagewd \vfil
  344.     \topregister \vskip\headmargin \runhead \DrawT@pLines }
  345.   \medskip
  346.   \advancepageno }
  347. \def\nextrunner{%
  348.   \ifnum\T@stCount>0
  349.     \ifnum\T@stCount>5 \TestCount=5 \else\TestCount=\T@stCount \fi
  350.     \advance\T@stCount by-\TestCount
  351.     \DrawT@pLines           % always one at top of page
  352.     \loop\ifnum\TestCount>1 \r@nhead \advance\TestCount by\m@ne \repeat
  353.     \newpage
  354.     \def\@next{\nextrunner}%
  355.   \else \def\@next{}%
  356.   \fi
  357.   \@next }
  358. %  Use \ExtraRunheads to generate running heads for stripping (e.g. for
  359. %  author-supplied camera-ready copy).  E.g., ``\ExtraRunheads 12, {}.'' will
  360. %  generate 12 TUGboat running heads, up to 5 per page, starting with
  361. %  the current page number.
  362. \def\ExtraRunheads #1, #2.{%
  363.   \T@stCount=#1
  364.   \gdef\pageprefix{#2}%   % as in A-10 for appendices; not used just now
  365.   \nextrunner }
  366. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  367. %                                                                            
  368. %     *****  insertions  *****
  369. %                                                                            
  370. \newif\if@floatable     \@floatabletrue         % sometimes we don't want
  371. \def\nofloat{\@floatablefalse}                  % midinsertions to float
  372. % redefine \@ins to avoid the \par of PLAIN
  373. \def\@ins{\begingroup\setbox\z@\vbox\bgroup}
  374. \newinsert\botins
  375. \newif\ifp@ge \newif\if@mid \newif\if@bot
  376. \def\topinsert{\@midfalse\p@gefalse\@botfalse\@ins}
  377. \def\botinsert{\@midfalse\p@gefalse\@bottrue\@ins}
  378. \def\midinsert{\@midtrue\@botfalse\@ins}
  379. \def\pageinsert{\@midfalse\@botfalse\p@getrue\@ins}
  380. \skip\botins=\z@skip
  381. \count\botins=1000
  382. \dimen\botins=\maxdimen
  383. \def\endinsert{\egroup % finish the \vbox
  384.   \gdef\@next{}%
  385.   \if@mid \dimen@\ht\z@ \advance\dimen@\dp\z@
  386.     \advance\dimen@12\p@ \advance\dimen@\pagetotal
  387.     \if@floatable    
  388.       \ifdim\dimen@>\pagegoal\@midfalse\@botfalse\p@gefalse\fi\fi
  389.   \fi
  390.   \if@mid
  391.     \vskip\abovedisplayskip
  392.     \box\z@
  393.     \vskip\belowdisplayskip
  394.     \gdef\@next{\@asifbelowdisplay}%
  395.   \else\insert\if@bot\botins\else\topins\fi
  396.    {\penalty100 % floating insertion
  397.     \if@bot\medskip\nobreak\fi
  398.     \splittopskip\z@skip
  399.     \splitmaxdepth\maxdimen \floatingpenalty\z@
  400.     \ifp@ge \dimen@\dp\z@
  401.       \vbox to\vsize{\unvbox\z@\kern-\dimen@}% depth is zero
  402.     \else \box\z@\fi
  403.     \if@bot\else\medskip\fi
  404.    }%
  405.   \fi\endgroup\@next}
  406. %  Footnotes are mainly supported by PLAIN format, with these
  407. %  exceptions.
  408. \skip\footins=10pt
  409. \def\footnoterule{\kern-8pt
  410.         \hrule width 5pc \kern 7.6pt } % the \hrule is .4pt high
  411. \newif\ifDelayFirstPar          \DelayFirstParfalse
  412. \def\vfootnote#1{\ifFirstPar \DelayFirstPartrue \fi
  413.   \insert\footins\bgroup
  414.   \interlinepenalty\interfootnotelinepenalty
  415.   \splittopskip\ht\strutbox % top baseline for broken footnotes
  416.   \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
  417.   \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
  418.   \rm \parindent=\normalparindent % always indent footnotes; added for TUGboat
  419.   \textindent{#1}\makestrut[10pt;\z@]\futurelet\next\fo@t}
  420. \def\@foot{\strut\egroup
  421.         \ifDelayFirstPar \SetupFirstPar \global\DelayFirstParfalse \fi }
  422. \newif\ifFirstPar       \FirstParfalse
  423. \def\SetupFirstPar{\global\parindent=\z@ \global\FirstPartrue }
  424. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  425. %                                                                            
  426. %     *****  output  *****
  427. %                                                                            
  428. %       Reorganize \pagecontents from PLAIN to put footnotes at very
  429. %       bottom of page, even if \raggedbottom.  Also add bottom insertions.
  430. \def\pagecontents{%
  431.   \ifvoid\topins\else\unvbox\topins\fi
  432.   \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255
  433.   \ifr@ggedbottom \kern-\dimen@ \vfil \fi
  434.   \ifvoid\footins\else % footnote info is present
  435.     \vskip\skip\footins
  436.     \footnoterule
  437.     \unvbox\footins\fi
  438.   \ifvoid\botins\else
  439.     \vskip\skip\botins
  440.     \unvbox\botins\fi }
  441. %  Trim (registration) marks may or may not be placed around the pages;
  442. %  Overlaying may or may not be done within TeX (as opposed
  443. %  to the device driver).
  444. \newif\ifTrimmarks              \Trimmarksfalse
  445. \newif\ifOverlaysinTeX          \OverlaysinTeXtrue
  446. %  All columns containing data are formatted by \midpage.  Trim marks
  447. %  are put on all columns, but running heads only on the last column
  448. %  (i.e. column number = \numcols)
  449. \def\midpage#1{%
  450.   \vbox{
  451.     \basezero
  452.     \hrule height\z@ depth\z@ width\p@
  453.     \ifTrimmarks
  454.       \vskip-1in                % default offset for laser printers
  455.                                 % this puts top trim at edge of paper
  456.       \vbox to \trimlgt \bgroup
  457.       \topregister
  458.       \vskip \headmargin
  459.     \else
  460.       \vskip-\rheadlgt           % this puts runhead above default offset
  461.     \fi
  462.     \vbox to \pagelgt{
  463.       \ifnum\xcol=\numcols \runhead \else \vbox to \rheadlgt{}\fi
  464.       \ifThisIsFirstPage \firsthead \fi
  465.       \hbox to \pagewd{#1}       % \vsize applied in \pagebody
  466.       \ifThisIsFirstPage \firstfoot \fi
  467.       \vfil                      % if no depth, avoid underfull box
  468.       \ifnum\xcol=\numcols \runfoot \else \vbox to \rfootlgt{}\fi
  469.       }
  470.     \ifTrimmarks \vfill \botregister \egroup \fi
  471.     }}
  472. %  The production version includes trim marks, which are required
  473. %  on photographic paper, but are unsuitable for laser printer output
  474. %  (because they land at the edges of the page).  For multiple
  475. %  column output, allowance is made for column overlays either
  476. %  within TeX or by the driver.  The default is to have all
  477. %  overlays done within TeX, but large pages or matters of efficiency
  478. %  may dictate that driver-overlay is more appropriate.
  479. %  When the overlaying is done within TeX, the .dvi contains just
  480. %  one page for each page to be printed.  However, in the case
  481. %  that a driver is to do the overlaying we must anticipate that
  482. %  it will not be smart enough to properly overlay different numbers
  483. %  of .dvi pages for different printed pages (e.g. in the case that
  484. %  one job has both single- and double-column layout).  Thus, for
  485. %  each printed page, TeX constructs a constant number (=\maxcols)
  486. %  of .dvi pages.  Columns 1 through and including \numcols will
  487. %  be usual .dvi pages containing information for the typeset columns.
  488. %  Upon reaching column number \numcols, TeX will `fill out' the
  489. %  printed page with empty columns to \maxcols.
  490. %  set up auxiliary `page numbers'
  491. %  \pageno = \count0  as used in PLAIN
  492. %  \xcol is the column number within a page; ranges from 1 to \maxcols
  493. \countdef\xcol=1        \xcol=1
  494. %  \spoolno is the ordinal number of `.dvi' pages (i.e. the number
  495. %  of \shipouts performed)
  496. \countdef\spoolno=2     \spoolno=0
  497. \def\newcol{\endgraf\vfill\eject}
  498. \def\newpage{%
  499.   \loop
  500.     {\leavevmode\endgraf\vfill\eject} % \xcol is advanced in the output routine
  501.   \ifnum\xcol>1
  502.   \repeat
  503. \newcount\numcols               % `real' number of columns
  504. \newcount\@maxcolsofar          % internal counter for box allocation
  505. \@maxcolsofar=0
  506. \newcount\maxcols               % job-wide maximum number of columns
  507. \maxcols=2
  508.                                 % save the column or ship it out
  509. \def\@saveorship{%
  510.   \ifOverlaysinTeX
  511.     \ifnum\xcol>\@maxcolsofar   % if we need another column box allocated
  512.       \global\advance\@maxcolsofar\@ne
  513.       \newboxcs{column\number\xcol}%
  514.     \fi
  515.     \global\setboxcs{column\number\xcol}%
  516.   \else
  517.     \global\advance\spoolno\@ne
  518.     \shipout
  519.   \fi
  520. %  horizontal offset of column from left edge of page
  521. \newdimen\coloffset             \coloffset\z@
  522. \def\incrcoloffset{%
  523.   \global\advance\coloffset\colwd
  524.   \global\advance\coloffset\intercolwd
  525. \def\output@{%
  526.   \@saveorship\midpage{\kern\coloffset\pagebody\hfil}
  527.   \incrcoloffset
  528.   \ifnum\xcol=\numcols   % if at `real' last column, fill out page with
  529.     \loop                % empty columns
  530.     \ifnum\xcol<\maxcols
  531.       \global\advance\xcol\@ne
  532.       \@saveorship\midpage{\vbox to \collgt{}\hfil}
  533.     \repeat
  534.   \fi
  535.   \ifnum\xcol=\maxcols   % put page together if TeX is overlaying
  536.     \ifOverlaysinTeX
  537.       \global\advance\spoolno\@ne
  538.       \shipout\hbox{%
  539.         \xcol=1
  540.         \loop \rlap{\boxcs{column\number\xcol}}%
  541.         \ifnum\xcol<\maxcols
  542.           \global\advance\xcol\@ne
  543.         \repeat
  544.         \hbox to \pagewd{}%
  545.         }%
  546.     \fi
  547.     \D@EndPage          % possible shortening of next page
  548.     \global\coloffset\ifodd\pageno\oddleftindent\else\evenleftindent\fi
  549.     \global\xcol=1
  550.   \else
  551.     \global\advance\xcol\@ne
  552.   \fi
  553.   \ExecuteNextDC         % possible `Delayed Command'
  554. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  555. %                                                                            
  556. %     *****  page adjustment  *****
  557. %                                                                            
  558. %  In the absence of automatic column-balancing, provide a mechanism
  559. %  for manually shortening a specified page.
  560. \newif\ifSh@rtPage              \Sh@rtPagefalse
  561. \newif\ifSh@rtPagePending       \Sh@rtPagePendingfalse
  562. \newcount\Sh@rtPageNo
  563. \newdimen\Sh@rtPageLgt
  564. \def\@to{to}                    \def\@by{by}
  565. %       #1 = to/by; #2 = \dimen; #3 = <dimen>; #4 = * of Shorten*Page
  566. \def\@toby#1#2#3#4{%
  567.   \def\@tb{#1}%
  568.   \ifx \@tb\@to \global #2=#3
  569.   \else \ifx \@tb\@by \T@stDimen=#3         % accommodate negative #3
  570.              #2=\normalcollgt \global\advance #2 by -\T@stDimen
  571.         \else \errmessage{#1 is invalid syntax; \string\Shorten#4Page
  572.                           requires "to" or "by"}\fi
  573.   \fi }
  574. \def\@plusno#1#2;{%
  575.   \if +#1\T@stCount=\pageno \advance\T@stCount by #2
  576.   \else \T@stCount=#1#2 \fi }
  577. \def\ShortenPage #1 #2 #3. {%
  578.   \global\Sh@rtPagePendingtrue
  579.   \@plusno#1;\global\Sh@rtPageNo=\T@stCount
  580.   \@toby{#2}{\Sh@rtPageLgt}{#3}{}}
  581. \def\ShortenThisPage #1 #2. {%
  582.   \global\Sh@rtPagetrue
  583.   \@toby{#1}{\vsize}{#2}{This}}
  584. %  Two cases: 0 = last page was nonstandard; reset \vsize
  585. %             1 = do not reset \vsize: okay or length already reset
  586. \def\D@EndPage{%
  587.   \global\advancepageno
  588.   \T@stCount=1
  589.   \ifThisIsFirstPage \T@stCount=0 \global\ThisIsFirstPagefalse
  590.                      \resetfirsthead \resetfirstfoot
  591.                      \global\collgt=\normalcollgt \fi
  592.   \ifSh@rtPage \T@stCount=0 \global\Sh@rtPagefalse \fi
  593.   \ifSh@rtPagePending
  594.     \ifnum\pageno = \Sh@rtPageNo \T@stCount=1
  595.       \global\vsize=\Sh@rtPageLgt
  596.       \global\Sh@rtPagePendingfalse
  597.       \global\Sh@rtPagetrue \fi
  598.   \fi
  599.   \ifcase \T@stCount \resetpagelgt \fi }
  600. %  Add more powerful means of adjusting pages by keeping a list of
  601. %  commands to be executed prior to making up the next page.  This
  602. %  technique will be expanded in the next version of the output
  603. %  routine.
  604. %  "\DelayedCommand <page number> <column number> <command>\endCommand"
  605. %  places the token list <command> at the end of a list of "things to do".
  606. %  At the end of every column, the output routine checks this list to
  607. %  see whether the head of the list should be "executed" prior to
  608. %  building the next column.  If so, the execution is performed.
  609. %  Right now, items must be placed in the execution list in order,
  610. %  and all items for a given column must be combined into a single
  611. %  token list.
  612. %  Natural applications are double column figures and column size
  613. %  adjustments.  E.g.
  614. %  \DelayedCommand +5 1 \global\advance\vsize by 2\baselineskip\endCommand
  615. %  will increase the \vsize of the first column of the page 5 pages from
  616. %  "now" by 2 baselines.  To pull the \vsize back to normal would require
  617. %  another use of \DelayedCommand.  Double column figures can be achieved
  618. %  with insertions called by \DelayedCommand.
  619. %  Right now the technique is messy, but it can be used by those who know
  620. %  how it's implemented and know its limitations.
  621. \newtoks\@DelayedCommandList
  622. \def\DelayedCommand #1 #2 #3\endCommand{%
  623.   \@plusno#1;%
  624.   \edef\@temp{\the\@DelayedCommandList<\number\T@stCount>}%
  625.   \global\@DelayedCommandList=\expandafter{\@temp<#2>#3\endCommand}%
  626. \def\@FindNextDCPoint <#1><#2>#3\endList{%
  627.   \def\DCpage{#1}\def\DCcolumn{#2}}
  628. \def\FindNextDCPoint{%
  629.   \edef\@temp{\the\@DelayedCommandList}%
  630.   \ifx\@temp\empty \def\DCpage{\@M}\def\DCcolumn{0}%
  631.   \else
  632.     \edef\@form{%
  633.       \noexpand\@FindNextDCPoint\the\@DelayedCommandList\noexpand\endList}%
  634.     \@form
  635.   \fi}
  636. \def\@ExecuteNextDC <#1><#2>#3\endCommand#4\endList{%
  637.   \global\@DelayedCommandList={#4}%
  638.   #3}
  639. \def\ExecuteNextDC{%
  640.   \FindNextDCPoint
  641.   \ifnum \pageno=\DCpage \ifnum\xcol=\DCcolumn
  642.     \edef\@form{%
  643.       \noexpand\@ExecuteNextDC\the\@DelayedCommandList\noexpand\endList}%
  644.     \@form
  645.   \fi \fi}
  646. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  647. %     *****  general mechanism for tags  *****
  648. %  Upon sensing an opening tag (call it `\foo' here), the following process
  649. %  is set in motion:
  650. %    1. \begingroup (so definitions and settings are localized);
  651. %    2. the default situation for \foo is set up;
  652. %    3. if appropriate, an \everyfoo list is read (this allows one
  653. %       to override the TUGboat.sty factory defaults);
  654. %    4. optional commands are read.  This involves looking ahead for
  655. %       a `[' and `normalizing' the optional environment so that
  656. %       backslashes and braces are interpreted as their standard selves.
  657. %       After the options are read, the `\',`{', and `}' are restored
  658. %       to their status appropriate to \foo;
  659. %    5. the \@beginfoo macro is executed.  This
  660. %       may involve branching dependent upon flags set by options.  It may
  661. %       also be a place where spaces and carriage-returns are activated.
  662. %    6. the `argument' to \foo is read and stored or processed on
  663. %       the fly (the method employed is generally fixed for each tag).
  664. %       The argument may be delimited by *...* (called the `short-form'
  665. %       here), or up to ...\endfoo (called the `long-form').
  666. %    7. a cleanup macro is executed which also ends the current group.
  667. %       This may do all the work if an argument has been read and stored.
  668. %  Checking ahead.
  669. %  Often we check ahead to determine the next course of action.
  670. %  \@checknexttoken is used to check for optional commands, to check for the
  671. %  short-form argument-delimiter, and to ignore characters in certain
  672. %  situations.  The macro is just a check; applications must do whatever
  673. %  is appropriate with the ensuing token.
  674. %  \@checknexttoken checks the next token against argument #1.  If the
  675. %  two are the same, #2 is executed, otherwise #3.  The comparison is
  676. %  done with \ifx.  Since we check ahead with \futurelet, the first
  677. %  argument is stored with \let as well.  To include the case
  678. %  where #1 may be a space, we have to go through a small contortion
  679. %  to \let\@basetoken= that space.
  680. %  At times, the \@nexttoken will be \outer and this will prevent its
  681. %  being incorporated in the definition of \@next below.  For this reason,
  682. %  we store `\ifx\@basetoken\@nexttoken' away in a definition at a time
  683. %  when \@nexttoken is undefined and won't cause a problem.
  684. \def\if@baseis@next{\ifx\@basetoken\@nexttoken}
  685. \long\def\@checknexttoken #1#2#3{%
  686.   \futurelet\@basetoken\iffalse#1\fi
  687.   \long\def\@next{%
  688. %    \ifx \@basetoken\@nexttoken
  689.     \if@baseis@next
  690.       \long\def\@@next{#2}%
  691.     \else\long\def\@@next{#3}\fi
  692.     \@@next}%
  693.   \futurelet\@nexttoken\@next}
  694. %  Eliminating characters from input.
  695. %  The following macros check ahead to see whether the next token is a
  696. %  token to be parsed from the input stream.  \@ignoreall keeps
  697. %  checking to eliminate all such characters, whereas \@ignoreone drops
  698. %  at most one.  Argument #2 is executed after characters are eliminated.
  699. %  The token is removed by defining a control sequence whose
  700. %  contextual form includes the token.
  701.         % execute #2 after ignoring (possibly) one occurrence of #1
  702. \long\def\@ignoreone#1#2{%
  703.   \def\@ignoreform#1{#2}%
  704.   \@checknexttoken{#1}{\@ignoreform}{#2}%
  705.         % execute #2 after ignoring all occurrences of #1
  706. \long\def\@ignoreall#1#2{%
  707.   \def\@ignoreform#1{\@ignoretest}%
  708.   \def\@ignoretest{\@checknexttoken{#1}{\@ignoreform}{#2}}%
  709.   \@ignoretest
  710. %  Particularly useful ignorances.
  711.         % execute #1 after ignoring spaces
  712. \def\DeleteOptionalSpaces#1{%
  713.   \@ignoreall{ }{#1}%
  714.         % execute #1 after ignoring spaces and \pars
  715. \def\DeleteOptionalSpacesandPars#1{%
  716.   \@ignoreall{ }{\@ignoreall{\par}{#1}}%
  717. %  Checking and reading options.
  718. %  To check for the next optional argument, the macros must look
  719. %  ahead to the next character.  If the next character is a `[',
  720. %  the option-reading mechanism is invoked.  This check may be suppressed if
  721. %  the user has executed the \lastoption option.  If \@lastoption is
  722. %  "true" or if the [ is NOT next, the macro goes on to reading any
  723. %  arguments and executing appropriately.
  724. \def\@checkoptions{%
  725.   \if@lastoption
  726.     \def\@next{\@executetoend}%
  727.   \else
  728.     \def\@next{\@checknexttoken {[}{\@readoptions}{\@executetoend}}%
  729.   \fi
  730.   \@next
  731. %  Default "options" on start-up.  Unless over-ridden, the situation
  732. %  will be:
  733. %    1. there may be another option to check (i.e. \@lastoptionfalse);
  734. %    2. it will be necessary to read the input file to determine the
  735. %       method of marking arguments (i.e. \@longformfalse);
  736. %    3. arguments will be handled on the fly (i.e. \@savingargumentfalse);
  737. %    4. the long-form ending delimiter will be \end... (where ... is
  738. %       the tag with which we're currently operating.
  739. \newif\if@lastoption            \@lastoptionfalse
  740. \def\lastoption{\@lastoptiontrue}
  741. \newif\if@longform              \@longformfalse
  742. \def\longform{\@longformtrue}
  743. \newif\if@savingargument        \@savingargumentfalse
  744. \newtoks\enddelim
  745. \def\@defaultoptions{%
  746.   \@lastoptionfalse
  747.   \@longformfalse
  748.   \@savingargumentfalse
  749.   \enddelim=\expandafter{\csname end\CurrentTag\endcsname}%
  750. %  To read an optional command, \catcodes of \ { } are restored to their plain
  751. %  values, and the [...] form is parsed out by \@@readoptions.  The argument
  752. %  to \@@readoptions is then executed, the 3 specials are restored and
  753. %  the we check again for [ after deleting spaces.  One might, alternatively,
  754. %  parse out the initial `[' and activate the `]' to end options, but
  755. %  this would make it awkward to place options within other macros (since
  756. %  the `]' would have to be \catcoded properly for the definition).
  757. \def\@readoptions{%
  758.   \savecat\\\makeescape\\%
  759.   \savecat\{\makebgroup\{%
  760.   \savecat\}\makeegroup\}%
  761.   \@@readoptions}
  762. \def\@@readoptions[#1]{%
  763.   #1%
  764.   \restorecat\\\restorecat\{\restorecat\}%
  765.   \DeleteOptionalSpaces{\@checkoptions}%
  766. %  Short Form Tagging.
  767. %  We specify a character (*) to be used as a begin/end delimiter
  768. %  for the argument to most tags.  This code could be copied and
  769. %  altered a bit to use another character.
  770. %  The character will be encountered as either type `other' or as
  771. %  an `active' character.
  772. \newtoks\@otherSFD
  773. \@otherSFD={*}
  774. \let\@SFD=*                     % used in \@checknexttoken
  775. \newtoks\@activeSFD
  776. {\makeactive\*
  777.   \global\@activeSFD={*}%
  778. \let\@plainast=\ast
  779. \def\ast{\ifmmode\@plainast\else *\fi}
  780. %  Reading to the end-tag.
  781. %  Macros may just do their business after options have been
  782. %  read.  In this case, there is no end-tag to worry about.
  783. %  Otherwise, the macros either read to the "long-form" of end-tag
  784. %  (e.g. \endtitle or \endauthor) or to the short-form (assumed to
  785. %  be * here).  Unless an option has specified
  786. %  that the long-form is to be used, the macros look ahead to
  787. %  see whether the short-form delimiter occurs next.  If so,
  788. %  it is assumed that the short-form is being used.  In any case,
  789. %  the appropriate \@begin... macro is executed before the argument is
  790. %  handled.
  791. \newcount\@numarguments         \@numarguments=1
  792. \def\@executetoend{%
  793.   \ifnum\@numarguments>0
  794.     \if@longform \def\@afterbegintag{\@longparse}%
  795.     \else
  796.       \def\@afterbegintag{\@checknexttoken
  797.                   {\@SFD}{\@shortparse}{\@longparse}}%
  798.     \fi
  799.   \else
  800.     \def\@afterbegintag{}%
  801.   \fi
  802.   \csname @begin\CurrentTag\endcsname
  803.   \@afterbegintag
  804. %  If the short-form is being used and an argument is to be saved,
  805. %  we must define a "form" which TeX may follow to pull out the
  806. %  tag's argument.  The argument is stored away in the token register
  807. %  \@argument, and the appropriate end-operation is performed.
  808. %  Otherwise (the `argument' is processed on-the-fly), we parse out
  809. %  the initial short-form delimiter and activate the ending one.
  810. \newtoks\@argument
  811. \def\@shortparse{%
  812.   \if@savingargument
  813.     \edef\@form{%
  814.       \def\noexpand\@@shortparse\the\@otherSFD####1\the\@otherSFD}%
  815.     \@form{\@argument{##1}\csname end\CurrentTag\endcsname}%
  816.   \else
  817.     \expandafter\makeactive\csname\the\@otherSFD\endcsname
  818.     \expandafter\def\the\@activeSFD
  819.       {\csname end\CurrentTag\endcsname
  820.        \expandafter\makeother\csname\the\@otherSFD\endcsname}%
  821.     \def\@@shortparse{%
  822.       \expandafter\@ignoreone\expandafter{\the\@otherSFD}%
  823.         {}%
  824.       }%
  825.   \fi
  826.   \@@shortparse}
  827. %  On the other hand, if the long form is used, TeX must parse to
  828. %  the long-form ending tag.  Ordinarily we know the ending-tag
  829. %  because it is just the \end... which corresponds to the tag
  830. %  which initiated the process.  We do allow for the possibility,
  831. %  however, that we may want to switch this for some reason. E.g.
  832. %  the different \verbatim styles allow for \verbatim...\endverbatim
  833. %  and ||...||.  The easiest way to implement the || style is
  834. %  to have the first || call \verbatim and have \verbatim know
  835. %  to look for || as the end-tag instead of \endverbatim.  This may
  836. %  be accomplished by allowing for the possibility of different
  837. %  end-tags as below.
  838. \def\@longparse{%
  839.   \if@savingargument
  840.     \edef\@form{\def\noexpand\@@longparse####1\the\enddelim}%
  841.     \@form{\global\@argument{##1}\csname end\CurrentTag\endcsname}%
  842.   \else \def\@@longparse{}\fi
  843.   \@@longparse
  844. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  845. %  Macros generally available to tags.
  846. \def\@authorstyle{\@@@a}
  847. \def\@inlinestyle{\@@@i}
  848. \def\@displaystyle{\@@@d}
  849. \def\@altinlinestyle{}
  850. \def\@altdisplaystyle{}
  851. \newif\if@removeprewhite        \@removeprewhitefalse
  852. \newif\if@removepostwhite       \@removepostwhitefalse
  853. \def\removeprewhite{\@removeprewhitetrue}
  854. \def\removepostwhite{\@removepostwhitetrue}
  855. %  Allow for line numbers on a listing as well as rules above and below.
  856. \newif\if@ruled         \@ruledfalse
  857. \newif\if@numbered      \@numberedfalse
  858. \newcount\linenumber
  859. \newcount\globallinenumber      \globallinenumber = 0
  860. \newif\if@continuingnumbers \@continuingnumbersfalse
  861. \def\continuenumbers{\numbered\@continuingnumberstrue}
  862. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  863. %     *****  title, section title, authors, addresses  *****
  864. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  865. %  title
  866. \def\title{%
  867.   \begingroup
  868.   \def\CurrentTag{title}%
  869.   \@defaultoptions
  870.   \@savingargumenttrue
  871.   \@checkoptions}
  872. \def\endtitle{%
  873.   \global\toks@=\expandafter{\the\@argument}%
  874.   \endgroup
  875.   \edef\thetitle{\ignorespaces\the\toks@\unskip}%
  876. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  877. %  section titles
  878. %  Material mostly in tugboat.com now
  879. \setbox\T@stBox=\hbox{\sectitlefont O}
  880. \newdimen\stfontheight          \stfontheight=\ht\T@stBox
  881. \def\sectitle{%
  882.   \begingroup
  883.   \def\CurrentTag{sectitle}%
  884.   \@defaultoptions
  885.   \@savingargumenttrue
  886.   \global\SecTitletrue
  887.   \@checkoptions}
  888. \def\endsectitle{%
  889.   \@sectitle{\the\@argument}%
  890.   \endgroup
  891. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  892. %  authors
  893. \newcount\authornumber
  894. \def\author{%
  895.   \begingroup
  896.   \def\CurrentTag{author}%
  897.   \global\advance\authornumber by 1
  898.   \@defaultoptions
  899.   \@savingargumenttrue
  900.   \@checkoptions}
  901. \def\endauthor{%
  902.   \global\toks@=\expandafter{\the\@argument}%
  903.   \endgroup
  904.   \expandafter\edef\csname theauthor\number\authornumber\endcsname
  905.       {\ignorespaces\the\toks@\unskip}%
  906.   \expandafter\let\csname theaddress\number\authornumber\endcsname\relax
  907.   \expandafter\let\csname thenetaddress\number\authornumber\endcsname\relax
  908. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  909. %  addresses
  910. \def\address{%
  911.   \begingroup
  912.   \def\CurrentTag{address}%
  913.   \@defaultoptions
  914.   \@savingargumenttrue
  915.   \let\@addressstyle=\@authorstyle
  916.   \def\inline{\let\@addressstyle=\@inlinestyle}%
  917.   \def\display{\let\@addressstyle=\@displaystyle}%
  918.   \@checkoptions}
  919. \def\endaddress{%
  920.   \ifx\@addressstyle\@inlinestyle
  921.     \def\\{, }\the\@argument
  922.     \endgroup
  923.     \def\@next{}%
  924.   \else\ifx\@addressstyle\@displaystyle
  925.     \endgraf\raggedright
  926.     \everypar={\hangindent 1.5\parindent}%
  927.     \def\\{\endgraf}%
  928.     \def\|{\unskip\hfil\break}%
  929.     \vskip\abovedisplayskip
  930.     \the\@argument\endgraf
  931.     \vskip\belowdisplayskip
  932.     \@asifbelowdisplay
  933.     \endgroup
  934.     \def\@next{\ignorespaces}%
  935.   \else
  936.     \global\toks@=\expandafter{\the\@argument}%
  937.     \endgroup
  938.     \expandafter\edef\csname theaddress\number\authornumber\endcsname
  939.       {\ignorespaces\the\toks@\unskip}%
  940.     \def\@next{}%
  941.   \fi \fi
  942.   \@next
  943. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  944. %  network addresses
  945. \def\netaddress{%
  946.   \begingroup
  947.   \def\CurrentTag{netaddress}%
  948.   \@defaultoptions
  949.   \@savingargumenttrue
  950.   \let\@network\relax%
  951.   \def\network##1{\def\@network{##1: }}%
  952.   \@SpecialsGetOther
  953.   \netaddrat
  954.   \netaddrpercent
  955.   \@checkoptions}
  956. {\makeactive\@
  957.  \gdef\netaddrat{\makeactive\@\def@{\char"40\discretionary{}{}{}}}
  958.  \makeactive\%
  959.  \gdef\netaddrpercent{\makeactive\%\def%{\char"25\discretionary{}{}{}}}
  960. %  We want the definition of \thenetaddress... to land at the right
  961. %  nesting level, so we have to first pull it to the top, then
  962. %  drop back to where we are.
  963. \def\endnetaddress{%
  964.   \global\toks@=\expandafter{\the\@argument}%
  965.   \ifx\@network\relax
  966.     \gdef\@@network{}%
  967.   \else
  968.     \xdef\@@network{\@network}%
  969.   \fi
  970.   \endgroup
  971.   \expandafter\edef\csname thenetaddress\number\authornumber\endcsname
  972.     {{\noexpand\rm\@@network}%
  973.      {\noexpand\netaddrat\noexpand\netaddrpercent\noexpand\net
  974.       \ignorespaces\the\toks@\unskip}}%
  975. \def\net{\tt}
  976. %  Overrides to default author and signature formats
  977. \def\authorlist#1{\def\@authorlist{#1}}
  978. %  Except for the first article in a section, beginnings of articles
  979. %  are announced by a horizontal rule the width of the column.
  980. %  In the case that this rule happens to fall at the top of a column,
  981. %  we have to make sure that it appears at the VERY top of the column
  982. %  and not just on the first baseline.  To accomplish this, we insert
  983. %  an empty rule first and then jump back over it to place the rule that
  984. %  readers will see.
  985. \def\article{%
  986.   \@allowspanningfigsfalse
  987.   \ifSecTitle \global\SecTitlefalse
  988.   \else \vskip\AboveTitleSkip
  989.     \kern\topskip
  990.     \nullhrule
  991.     \kern-\topskip
  992.     \kern-\strulethickness
  993.     \hrule height\strulethickness depth\z@
  994.     \nobreak
  995.     \kern\medskipamount
  996.   \fi
  997.   \ifx\thetitle\relax
  998.   \else
  999.     \nobreak
  1000.     {\parskip\z@
  1001.       \noindent\def\\{\unskip\break}\raggedright\bf
  1002.       \ignorespaces\thetitle\unskip\endgraf}%
  1003.   \fi
  1004.   \ifnum\authornumber>0
  1005.     \nobreak
  1006.     \vskip4pt
  1007.     {\parskip\z@
  1008.      \def\\{\unskip\hfil\break}\hangindent\parindent\raggedright
  1009.      \@authorlist\endgraf}
  1010.   \fi
  1011.   \nobreak
  1012.   \vskip \BelowTitleSkip
  1013.   \vskip -\parskip
  1014.   \tenpoint
  1015.   \DeleteOptionalSpacesandPars{\noindent\ignorespaces}%
  1016. \def\endarticle{\vfil\end}              % redefined in drivers
  1017. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1018. %     *****  heads  *****
  1019. %  Heads are set by first saving the text of the head in \@argument
  1020. %  and then operating appropriately depending upon the \headlevel.
  1021. %  Selection among the different heads is made by an \ifcase.
  1022. %  To remove extra \par tokens between heads and ensuing text in the
  1023. %  input file, we call \DeleteOptionalSpacesandPars.  To do this outside
  1024. %  the `head' group and just before TeX returns to the normal input stream
  1025. %  following a call to \head, we must define (globally) a control sequence
  1026. %  (\@next) and call it at the very end.
  1027. \newcount\headlevel     \headlevel=1
  1028. \def\head{%
  1029.   \begingroup
  1030.   \def\CurrentTag{head}%
  1031.   \@allowindentfalse
  1032.   \@defaultoptions
  1033.   \@savingargumenttrue
  1034.   \def\\{\break}%
  1035.   \@checkoptions}
  1036. \def\endhead{%
  1037.   \endgraf
  1038.   \ifcase\headlevel\or\@domainhead\or\@dosubhead\or\@dosubsubhead\fi
  1039.   \endgroup
  1040.   \@next
  1041. \def\@domainhead{%
  1042.   \if@removeprewhite\else\vskip\baselineskip\fi
  1043.   \noindent{\raggedright\bf\ignorespaces\the\@argument\unskip\endgraf}%
  1044.   \if@removepostwhite          %  usually we want the white space
  1045.   \else\kern0.5\baselineskip\fi
  1046.   \nobreak
  1047.   \gdef\@next{%
  1048.     \if@allowindent\def\@next{}%  usually we don't want to indent here
  1049.     \else\def\@next{\DeleteOptionalSpacesandPars{\noindent\ignorespaces}}\fi
  1050.     \@next
  1051.     }%
  1052. \def\@dosubhead{%
  1053.   \if@removeprewhite\else\medskip\fi
  1054.   \noindent{\frenchspacing\bf\ignorespaces\the\@argument\unskip.}%
  1055.     \hskip 0.5em plus \fontdimen3\the\font
  1056.   \gdef\@next{\DeleteOptionalSpacesandPars{}}%
  1057. \def\@dosubsubhead{%
  1058.   {\frenchspacing\bf\ignorespaces\the\@argument\unskip}%
  1059.     \hskip 0.5em plus \fontdimen3\the\font
  1060.   \gdef\@next{\DeleteOptionalSpacesandPars{}}%
  1061. \def\subhead{\head[\headlevel=2]}
  1062. \def\subsubhead{\head[\headlevel=3]}
  1063. \newif\if@allowindent
  1064. \def\allowindent{\global\@allowindenttrue}
  1065. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1066. %     *****  text and subtext  *****
  1067. %  The code here exists primarily to implement \subtext.  The treatment
  1068. %  is similar to that for \head in that an \ifcase statement is called
  1069. %  to choose between the various text levels.  Here, however, we handle
  1070. %  the `text' on the fly instead of saving it as an argument.
  1071. \newcount\textlevel     \textlevel=1
  1072. \def\text{%
  1073.   \begingroup
  1074.   \def\CurrentTag{text}%
  1075.   \@defaultoptions
  1076.   \@savingargumentfalse
  1077.   \@checkoptions}
  1078. \def\@begintext{%
  1079.   \endgraf
  1080.   \ifcase\textlevel\or\or\@setupsubtext\fi
  1081. \def\@setupsubtext{%
  1082.   \vskip\abovedisplayskip
  1083.   \advance\leftskip by 0.5\parindent
  1084.   \advance\rightskip by 0.5\parindent
  1085.   \ninepoint\rm
  1086. \def\endtext{%
  1087.   \gdef\@next{}%
  1088.   \ifcase\textlevel\or\or\@dosubtext\fi
  1089.   \endgroup
  1090.   \@next
  1091. \def\@dosubtext{%
  1092.   \endgraf
  1093.   \vskip\belowdisplayskip
  1094.   \gdef\@next{\@asifbelowdisplay}%
  1095. \def\subtext{\text[\textlevel=2]}
  1096. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1097. %     *****  lists  *****
  1098. \newcount\listlevel     \listlevel=1
  1099. \newif\if@itemized
  1100. \newcount\itemnumber
  1101. \newtoks\@itemtag
  1102. \newcount\@cols                 % number of columns in list
  1103. \newdimen\colsepwidth
  1104. \newdimen\@listindent
  1105. \newdimen\@listhangindent
  1106. \newif\if@firstitem             % when first item is handled differently
  1107. \newtoks\everylist
  1108. \def\list{%
  1109.   \begingroup
  1110.   \def\CurrentTag{list}%
  1111.   \let\@liststyle=\@displaystyle
  1112.   \def\inline{\let\@liststyle=\@inlinestyle}%
  1113.   \def\display{\let\@liststyle=\@displaystyle}%
  1114.   \def\displaystyle##1{\def\@altdisplaystyle{##1}}%
  1115.   \def\inlinestyle##1{\def\@altinlinestyle{##1}}%
  1116.   \def\item{%
  1117.     \begingroup
  1118.     \def\CurrentTag{item}%
  1119.     \@numarguments=0
  1120.     \@checkoptions}%
  1121.   \@itemtag={$\bullet$}%
  1122.   \def\tag##1{\@itemtag{##1}}%
  1123.   \def\tagform##1{\llap{##1\strutt\enspace}}%
  1124.   \@itemizedtrue
  1125.   \def\unitemized{\@itemizedfalse}%
  1126.   \itemnumber=0
  1127.   \def\numbered{\@itemtag={\number\itemnumber.}}%
  1128.   \def\romannumeraled{\@itemtag={\romannumeral\itemnumber.}}%
  1129.   \def\Romannumeraled{\@itemtag=
  1130.     {\uppercase\expandafter{\romannumeral\itemnumber.}}}%
  1131.   \def\lettered{\itemnumber="60 \@itemtag={\char\itemnumber.}}%
  1132.   \def\Lettered{\itemnumber="40 \@itemtag={\char\itemnumber.}}%
  1133.   \def\ruled{\@ruledtrue}%
  1134.   \@ruledfalse
  1135.   \@cols=1
  1136.   \def\cols{\@cols}%
  1137.   \@firstitemtrue
  1138.   \def\@itemseparator{, }%
  1139.   \def\itemseparator##1{\def\@itemseparator{##1}}%
  1140.   \@defaultoptions
  1141.   \@savingargumentfalse
  1142.   \the\everylist
  1143.   \@checkoptions}
  1144. \def\@beginlist{%
  1145.   \ifx\@liststyle\@displaystyle
  1146.     \endgraf
  1147.     \ifnum\listlevel=1
  1148.       \if@ruled \if@removeprewhite\else\medskip\fi \hrule\kern5pt \nobreak
  1149.       \else \if@removeprewhite\else\vskip\abovedisplayskip \fi\fi
  1150.     \fi
  1151.     \advance\leftskip\parindent
  1152.     \@listindent=\parindent
  1153.     \@listhangindent=\@listindent
  1154.     \parindent\@listindent
  1155.     \lineskip\z@
  1156.     \if@itemized
  1157.     \else
  1158.       \parskip\z@skip
  1159.       \parindent\z@
  1160.       \raggedright
  1161.       \everypar={\advance\itemnumber\@ne
  1162.                  \tagform{\the\@itemtag}}%
  1163.       \makeCtrlMendgraf
  1164.     \fi
  1165.     \def\colsep{%
  1166.       \global\count@\itemnumber
  1167.       \egroup\kern\colsepwidth
  1168.       \vtop\bgroup
  1169.       \@altdisplaystyle
  1170.       \itemnumber=\count@\ignoreendline}%
  1171.     \ifnum\@cols>1
  1172.       \dimen@\colsepwidth
  1173.       \multiply\dimen@\@cols
  1174.       \advance\dimen@-\colsepwidth
  1175.       \advance\hsize-\dimen@
  1176.       \divide\hsize by\@cols
  1177.       \hbox\bgroup\vtop\bgroup
  1178.     \fi
  1179.     \@altdisplaystyle
  1180.   \else
  1181.     \def\tagform##1{##1\strutt\ }%
  1182.     \if@itemized
  1183.     \else
  1184.        \makeCtrlMseparator
  1185.        \advance\itemnumber by \@ne
  1186.        \tagform{\the\@itemtag}%
  1187.     \fi
  1188.     \def\colsep{}%
  1189.     \@altinlinestyle
  1190.   \fi
  1191. \def\endlist{%
  1192.   \ifx\@liststyle\@displaystyle
  1193.     \if@itemized\endgraf\fi
  1194.     \ifnum\@cols>1
  1195.       \egroup   % vtop
  1196.       \egroup   % hbox
  1197.     \fi
  1198.     \ifnum\listlevel=1
  1199.       \if@ruled \kern5pt\hrule\nobreak\vskip2\medskipamount
  1200.       \else \nobreak
  1201.         \if@removepostwhite\else\vskip\belowdisplayskip\fi
  1202.       \fi
  1203.       \gdef\@next{\@asifbelowdisplay}%
  1204.     \fi
  1205.   \else \gdef\@next{}%
  1206.   \fi
  1207.   \endgroup     % list
  1208.   \@next
  1209. \def\sublist{\list[\listlevel=2]}
  1210. \newtoks\everyitem      \everyitem{}
  1211. \def\@beginitem{%
  1212.   \ifx\@liststyle\@displaystyle
  1213.     \endgraf
  1214.     \if@firstitem\@firstitemfalse\else\vskip\smallskipamount\fi
  1215.     \advance\itemnumber by \@ne
  1216.     \noindent\leavevmode
  1217.     \the\everyitem
  1218.     \tagform{\the\@itemtag}%
  1219.   \else
  1220.     \def\item{\if@firstitem\@firstitemfalse\else\unskip\@itemseparator\fi
  1221.               \advance\itemnumber by \@ne\the\@itemtag\enspace}%
  1222.   \fi  
  1223.   \global\count@\itemnumber
  1224.   \global\dimen@\hangindent
  1225.   \endgroup
  1226.   \itemnumber\count@
  1227.   \hangindent\dimen@
  1228. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1229. %     *****  verbatim  *****
  1230. %  Operation here is very similar to that for the other tags.
  1231. %  The opening tag sets up the situation and looks for optional
  1232. %  commands and the short-form delimiters.  Since initial setup
  1233. %  involves changing the special characters to characters of
  1234. %  type other, some juggling must be done when optional commands
  1235. %  are read.  In addition, to allow for implementation of the
  1236. %  |...| style using the more verbose \verbatim...\endverbatim,
  1237. %  we parameterize the ending-delimiter.
  1238.         % sets default to display style
  1239. \def\verbatim{\@verbatim[\display]}
  1240. \def\@verbatim{%
  1241.   \begingroup
  1242.   \setupverbatim
  1243.   \@checkoptions
  1244. \def\setupverbatim{%
  1245.   \def\CurrentTag{verbatim}%
  1246.   \@defaultoptions
  1247.   \def\inline{\global\let\@verbstyle\@inlinestyle}%
  1248.   \def\display{\global\let\@verbstyle\@displaystyle}%
  1249.   \def\displaystyle##1{\def\@altdisplaystyle{##1}}%
  1250.   \def\inlinestyle##1{\def\@altinlinestyle{##1}}%
  1251.   \def\numbered{\@numberedtrue}%
  1252.   \def\ruled{\@ruledtrue}%
  1253.   \@SpecialsGetOther
  1254.   \enddelim=\expandafter{\endverbdelimiter}%
  1255.   \normalspaces\frenchspacing
  1256.   \obeylines
  1257.   \@savingargumenttrue
  1258.   \the\everyverbatim
  1259. \def\@SpecialsGetOther{%
  1260.   \catcode`\\=\other
  1261.   \catcode`\{=\other \catcode`\}=\other \catcode`\$=\other
  1262.   \catcode`\&=\other \catcode`\#=\other \catcode`\%=\other
  1263.   \catcode`\~=\other \catcode`\_=\other \catcode`\^=\other
  1264.   \the\@AdditionsToSpecialsGetOther}
  1265. %  The \@Additions... register above should be used whenever another
  1266. %  character is declared to be special for some purpose.  E.g.,
  1267. %  we will use the | for the short-form |...| verbatim notation.
  1268. %  Since the | is generally active for this purpose, it's category
  1269. %  won't get changed to \other for use in \verbatim...\endverbatim
  1270. %  unless we add it via this mechanism.
  1271. \newtoks\@AdditionsToSpecialsGetOther
  1272. \def\AddToSpecialsGetOther#1{%
  1273.   \@AdditionsToSpecialsGetOther=
  1274.    \expandafter{\the\@AdditionsToSpecialsGetOther#1}}
  1275. %  Altering the verbatim setup.
  1276. %  Users can alter the setup to their purpose by
  1277. %  putting tokens in the register \everyverbatim.
  1278. \newtoks\everyverbatim
  1279. %  Ordinarily the end-tag would be the single token `\endverbatim'.
  1280. %  The following allows us to `see' the tag when `\' is of type `other'.
  1281. {\catcode`\|=0 \catcode`\\=\other
  1282. |gdef|endverbdelimiter{\endverbatim}}
  1283. %  Input from an external variable or file
  1284. \def\inputfromvar#1{\def\@verbinputvar{#1}}%
  1285. \def\inputfromfile#1{\def\@verbinputfile{#1 }}%
  1286. \let\@verbinputvar\relax
  1287. \let\@verbinputfile\relax
  1288. %  Outputs
  1289. \newif\if@outputtotype  \@outputtotypetrue
  1290. \def\notype{\@outputtotypefalse}
  1291. \def\outputtovar#1{\def\@verboutputvar{#1}}
  1292. \def\outputtofile#1{\def\@verboutputfile{#1}}
  1293. \let\@verboutputvar\relax
  1294. \let\@verboutputfile\relax
  1295. \newwrite\verboutfile
  1296. \def\@beginverbatim{\obeyspaces}%\obeylines}
  1297. \def\endverbatim{%
  1298.  \ifx\@verboutputvar\relax\else         % output to `variable'
  1299.    \expandafter\xdef\csname\@verboutputvar\endcsname{\the\@argument}%
  1300.  \ifx\@verboutputfile\relax\else        % output to file
  1301.    \immediate\openout\verboutfile=\@verboutputfile
  1302.    \makeCtrlMnewlinechar
  1303.    \iffalse{\fi\expandafter\@setupverbwrite\the\@argument}% use \@setupwrite to
  1304.    \immediate\closeout\verboutfile        % get rid of initial ^^M
  1305.  \gdef\@next{}%                         % in case following clause is false
  1306.  \if@outputtotype                       % output typeset on page
  1307.   \tt
  1308.   \ifx\@verbstyle\@inlinestyle
  1309.     \@beforeverbinline
  1310.     \@altinlinestyle
  1311.   \else
  1312.     \@beforeverbdisplay
  1313.     \@altdisplaystyle
  1314.   \fi
  1315.   \ifx\@verbinputvar\relax\else         % input from `variable'
  1316.     \csname\@verbinputvar\endcsname
  1317.   \fi
  1318.   \ifx\@verbinputfile\relax\else        % input from file
  1319.     \input \@verbinputfile
  1320.     \@endverbatim
  1321.   \fi
  1322.   \expandafter\@ignoreCtrlMverbendline\the\@argument\@endverbatim
  1323.   \ifx\@verbstyle\@inlinestyle
  1324.     \@afterverbinline
  1325.   \else
  1326.     \@afterverbdisplay\gdef\@next{\@asifbelowdisplay}%
  1327.   \fi
  1328.  \endgroup
  1329.  \@next
  1330. \def\@beforeverbinline{%
  1331.     \makeCtrlMverbspace
  1332.     \let\@endverbatim=\empty
  1333. \def\@beforeverbdisplay{%
  1334.   \def\@endverbatim{\verbendline}%
  1335.   \if@ruled \medskip \hrule\kern5pt \nobreak
  1336.   \else \vskip\abovedisplayskip
  1337.   \fi
  1338.   \makespaceverbspace
  1339.   \makeCtrlMverbendline
  1340.   \parskip=\z@skip
  1341.   \if@numbered \parindent=\z@
  1342.     \if@continuingnumbers
  1343.     \else \global\globallinenumber = \z@ \fi
  1344.     \linenumber=\z@ \fi
  1345.   \everypar={\global\advance\globallinenumber by\@ne
  1346.           \advance\linenumber by\@ne
  1347.           \ifnum\linenumber<3 \vadjust{\nobreak}\fi
  1348.           \if@numbered \leavevmode
  1349.               \hbox to\normalparindent{\hss\sevenrm\the\globallinenumber.\ }%
  1350.           \fi}%
  1351.   \frenchspacing\rightskip=-\ttrightskip \hyphenpenalty\@M
  1352. %  \ttrightskip is the permissible overhang beyond right margin;
  1353. %  in MANMAC, this is 5pc, which is fine for the TeXbook, but too much here.
  1354. \newdimen\ttrightskip   \ttrightskip=1pc
  1355. \def\@afterverbinline{}
  1356. \def\@afterverbdisplay{%
  1357.   \if@ruled \kern5pt\hrule\fi
  1358.   \ifnum\linenumber<3 \penalty\z@ \fi
  1359.   \if@removepostwhite\else
  1360.     \if@ruled \vskip2\medskipamount \else \vskip\belowdisplayskip\fi
  1361.   \fi
  1362. \def\@asifbelowdisplay{%
  1363.   \toks@=\expandafter{\the\everypar}%
  1364.   \noindent
  1365.   \everypar=\expandafter{\the\toks@}%
  1366.   \ignorespaces}
  1367. %  Definitions of spaces and ^^M
  1368. %  \@ignoreCtrlMverbendline is used to lop off an initial ^^M in
  1369. %  verbatim text and to remove an \@endverbatim (the latter in case the
  1370. %  verbatim text is actually empty)
  1371. \def\@ignoreendverbatim{\@ignoreone{\@endverbatim}{}}
  1372. \def\verbendline{\leavevmode\null\endgraf}
  1373. \def\makeCtrlMactive{\catcode`\^^M=\active}
  1374. {\makeCtrlMactive
  1375. \gdef\makeCtrlMverbendline{\makeCtrlMactive%
  1376.  \def^^M{\@ignoreone{\@endverbatim}{\verbendline}}}%
  1377. \makeCtrlMverbendline%
  1378. \gdef\@ignoreCtrlMverbendline{\@ignoreone{
  1379. }{\@ignoreendverbatim}}%
  1380. \gdef\@setupverbwrite{\@ignoreone{
  1381. }{\immediate\write\verboutfile\bgroup}}%
  1382. \gdef\makeCtrlMverbspace{\makeCtrlMactive\def^^M{\verbatimspace}}%
  1383. \gdef\makeCtrlMnewlinechar{\newlinechar=`\^^M}%
  1384. \gdef\makeCtrlMendgraf{\makeCtrlMactive\def^^M{\strutt\endgraf}}%
  1385. \gdef\makeCtrlMseparator{\makeCtrlMactive%
  1386.   \def^^M{%
  1387.     \@checknexttoken {\endlist}{}{%
  1388.       \@itemseparator\advance\itemnumber by \@ne \tagform{\the\@itemtag}%
  1389.       \ignorespaces}}}%
  1390. %  to read a variable or file name properly, we must interpret
  1391. %  spaces and ^^M as nothing or as spaces
  1392. {\makeCtrlMactive\obeyspaces%
  1393. \gdef\makeCtrlMempty{\def^^M{}}%
  1394. \gdef\makespaceempty{\def {}}%
  1395. {\makeCtrlMactive\obeyspaces%
  1396. \gdef\makeCtrlMspace{\def^^M{\space}}%
  1397. \gdef\makespacespace{\def {\space}}%
  1398. {\makeCtrlMactive%
  1399. \gdef\@ignoreCtrlM#1{\@ignoreone{^^M}{#1}}%
  1400. \gdef\ignoreendline{\@ignoreCtrlM{}}%
  1401. %  From David Eppstein's ``Trees'' paper (6#1), preserve initial spaces.
  1402. \def\verbatimspace{\ifvmode\indent\fi\space}
  1403. {\obeyspaces\gdef\makespaceverbspace{\def {\verbatimspace}}}
  1404. %  Options and variants.
  1405. \def\verbinline{\verbatim[\inline]}
  1406. \def\verbdisplay{\verbatim[\display]}
  1407. \def\verbfile#1{\verbatim[\inputfromfile{#1}]}
  1408. %  Verbatim with the other characters (e.g. |...|).
  1409. %  Procedures are parameterized so that it is easy to allow
  1410. %  different characters to perform this function.  Any character
  1411. %  that's chosen could cause problems if it occurs unexpectedly
  1412. %  in the middle of what is supposed to be verbatim text.  We call
  1413. %  the current special character for this purpose the "verbchar"
  1414. %  and store it in active form in the token register \@verbchar.
  1415. \newtoks\@verbchar
  1416. %  On hitting a "verbchar" in the middle of text, TeX must look ahead
  1417. %  to see whether the verbchar occurs again.  Since this
  1418. %  look-ahead fixes the category of the token examined, we must change
  1419. %  the categories of all characters appropriately before looking
  1420. %  (and we read \everyverbatim in case it contains a category change).
  1421. %  We must also "gobble" the second verbchar if we hit one.
  1422. %  Depending upon whether 1 or 2 verbchars are found, we call
  1423. %  \verbatim with the appropriate style command.  We also use an
  1424. %  optional command to change the delimiter which ends this \verbatim
  1425. %  block.  We naturally localize the changes to category codes made on
  1426. %  startup.  It's easier to end this group here at the beginning and to
  1427. %  restart everything in a standard \verbatim than it is to add an extra
  1428. %  \endgroup after the verbatim text.
  1429. \def\@firstverbchar{%
  1430.   \begingroup
  1431.   \setupverbatim
  1432. %  \@SpecialsGetOther
  1433.   \makeverbcharactive
  1434.   \expandafter\@checknexttoken\expandafter{\the\@verbchar}%
  1435.     {\expandafter\@ignoreone\expandafter{\the\@verbchar}%
  1436.       {\endgroup\verbatim[\longform\maketwoendverb]}}%
  1437.     {\endgroup\verbatim[\inline\longform\makeoneendverb]}%
  1438. \def\setupverbchar{%
  1439.  \def\makeoneendverb{\catcode\expandafter`\csname\expandafter
  1440.         \string\the\@verbchar\endcsname=
  1441.     \active\edef\endverbdelimiter{\the\@verbchar}%
  1442.     \enddelim=\expandafter{\endverbdelimiter}}%
  1443.   \def\maketwoendverb{\catcode\expandafter`\csname\expandafter
  1444.         \string\the\@verbchar\endcsname=
  1445.     \active\edef\endverbdelimiter{\the\@verbchar\the\@verbchar}%
  1446.     \enddelim=\expandafter{\endverbdelimiter}}%
  1447.   \expandafter\let\the\@verbchar\@firstverbchar
  1448.   \makeverbcharactive
  1449.   \AddToSpecialsGetOther{%
  1450.     \catcode\expandafter`\csname
  1451.         \expandafter\string\the\@verbchar\endcsname=\other}%
  1452. \def\makeverbcharactive{%
  1453.   \catcode\expandafter`\csname
  1454.         \expandafter\string\the\@verbchar\endcsname=\active}
  1455. {\makeother\| \gdef\VertChar{|}}
  1456. {\makeactive\|
  1457. \gdef\makevertverbchar{%
  1458.   \@verbchar={|}%
  1459.   \setupverbchar
  1460. {\makeother\! \gdef\WowChar{!}}
  1461. {\makeactive\!
  1462. \gdef\makewowverbchar{%
  1463.   \@verbchar={!}%
  1464.   \setupverbchar
  1465. \def\MTH{$}
  1466. \def\sb{_}
  1467. \def\sp{^}
  1468. \def\SP{{\tt\char"20 }}         % "visible" space
  1469. \chardef\bs=`\\
  1470. \def\vrt{{\tt\char`\|}}
  1471. \def\brokenvert{\hbox to 5.24998pt{\hfill
  1472.   \lower 1.5pt\vbox to 8.5pt{\hrule width .9pt height 3.25pt
  1473.   \vfill\hrule width .9pt height 3.25pt}\hfill}}
  1474. \def\@lt{$<$}
  1475. \def\@gt{$>$}
  1476. {\makeactive\<
  1477. \gdef\enablemetacode{%
  1478.   \AddToSpecialsGetOther{\catcode`\<=\other}%
  1479.   \makeactive\<%
  1480.   \def<##1>{$\langle${\it\makeCtrlMspace\makespacespace##1\/}$\rangle$}%
  1481. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1482. %     *****  figures  *****
  1483. \newif\if@@mid  \@@midfalse
  1484. \newif\if@@bot  \@@botfalse
  1485. \def\@caption{}
  1486. \newif\if@fixed \@fixedfalse
  1487.         % items for top and bottom ``banners'' on first page
  1488. \def\resetfirsthead{\global\toplgt=\z@ \gdef\firsthead{}}
  1489. \resetfirsthead
  1490. \newbox\firsth@@d       \newbox\firsth@ad
  1491. \def\resetfirstfoot{\global\botlgt=\z@ \gdef\firstfoot{}}
  1492. \resetfirstfoot
  1493. \newbox\firstf@@t       \newbox\firstf@ot
  1494. \newif\if@allowspanningfigs
  1495. \newcount\@figurepage
  1496. \newcount\@figurescol
  1497. \newcount\@figureecol
  1498. \def\figure{%
  1499.   \begingroup
  1500.   \def\CurrentTag{figure}%
  1501.   \@defaultoptions
  1502.   \@savingargumentfalse
  1503.   \def\top{}%
  1504.   \def\bot{\@@bottrue}%
  1505.   \def\mid{\@@midtrue}%
  1506.   \def\caption##1{\def\@caption{\ulap{\bigskip##1\smallskip}}}%
  1507.   \def\fixed{\@fixedtrue}%
  1508.   \def\scol{\@figurescol}%
  1509.   \def\ecol{\@figureecol}%
  1510.   \@figurepage=\pageno
  1511.   \@figurescol=1
  1512.   \@figureecol=\numcols
  1513.   \def\page{%
  1514.     \@ignoreall{\space}%
  1515.       {\@ignoreone{=}%
  1516.          {\@ignoreall{\space}%
  1517.             {\@checknexttoken{+}{\@ignoreone{+}{\advance\@figurepage by}}%
  1518.                  {\@figurepage=}%
  1519.             }%
  1520.          }%
  1521.       }%
  1522.     }%
  1523.   \@checkoptions}
  1524. \def\@beginfigure{%
  1525.   \if@fixed
  1526.     \global\ThisIsFirstPagetrue
  1527.     \setbox\T@stBox=\vbox\bgroup \hsize\pagewd
  1528.   \else
  1529.     \if@@mid\midinsert\else\if@@bot\botinsert\else\topinsert\fi\fi
  1530.   \fi
  1531. \def\endfigure{%
  1532.   \@caption
  1533.   \if@fixed
  1534.     \egroup
  1535.     \if@allowspanningfigs
  1536.       \ifnum\@figurepage>\pageno
  1537.         \immediate\write\sixt@@n{^^J
  1538.            Setting multiple column figures currently not allowed on pages^^J
  1539.            other than the first of each article.  Check your source file.^^J}%
  1540.       \else
  1541.         \if@@bot
  1542.           \ifdim \botlgt=\z@ \global\botlgt=\ht\T@stBox \resetpagelgt \fi
  1543.           \global\setbox\firstf@ot=\vbox to \botlgt{\box\T@stBox \vfil}%
  1544.           \global\setbox\firstf@@t=\vbox to \botlgt{\vfil}%
  1545.           \gdef\firstfoot{\ifnum \xcol=2 \copy\firstf@ot
  1546.                                   \else \copy\firstf@@t \fi }%
  1547.         \else
  1548.           \ifdim \toplgt=\z@ \global\toplgt=\ht\T@stBox \resetpagelgt \fi
  1549. %                       assume that \firsth@ad ends with glue, hence no \dp
  1550.           \global\setbox\firsth@ad=\vbox to \toplgt{\box\T@stBox \vfil}%
  1551.           \global\setbox\firsth@@d=\vbox to \toplgt{\vfil}%
  1552.           \gdef\firsthead{\ifnum \xcol=2 \box\firsth@ad
  1553.                                   \else \copy\firsth@@d \fi }%
  1554.         \fi
  1555.       \fi
  1556.     \else
  1557.       \immediate\write\sixt@@n{^^J
  1558.          Setting multiple column figures currently not allowed after^^J
  1559.          article has begun.^^J}%
  1560.     \fi
  1561.   \else \endinsert
  1562.   \fi
  1563.   \endgroup
  1564. \def\twocolfigure{%
  1565.   \figure[\fixed]}
  1566. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1567. %     *****  utilities  *****
  1568. \def\linebreak{\unskip\break}           % conflicts with LaTeX definition
  1569. %  Define a structure that will permit a list (using \obeylines)
  1570. %  to be made into 2 columns, split by \vsplit, indented the
  1571. %  normal \parindent
  1572. \def\NormalizeBlockHeight{%
  1573.   \TestCount=1                         % \@ne
  1574.   \TestDimen=\dimen0 \advance\TestDimen by-\topskip
  1575.   \CutOneLine }
  1576. \def\CutOneLine{%
  1577.   \advance\TestCount by 1 \advance\TestDimen by-\baselineskip
  1578.   \ifdim\TestDimen < \baselineskip                        % \@ne
  1579.      \def\result{%
  1580.        \TestDimen=\baselineskip
  1581.        \multiply\TestDimen by \TestCount
  1582.        \advance\TestDimen by \topskip
  1583.        \global\dimen0=\TestDimen }%
  1584.   \else \def\result{\CutOneLine }\fi
  1585.   \result }
  1586. \def\twosplit{%
  1587.   {\topskip=\baselineskip \splittopskip=\topskip
  1588.    \setbox0=\copy\TestBox
  1589.    \dimen0=\ht\TestBox
  1590.    \NormalizeBlockHeight
  1591.    \divide\dimen0 by 2
  1592.    \setbox\LeftHalf=\vsplit\TestBox to \dimen0
  1593.    \ifdim\ht\TestBox > \ht\LeftHalf
  1594.      \advance\dimen0 by \baselineskip
  1595.      \setbox\TestBox=\copy0
  1596.      \setbox\LeftHalf=\vsplit\TestBox to \dimen0
  1597.    \fi
  1598.    \line{\kern\parindent\valign{##\vfil\cr
  1599.          \unvbox\LeftHalf\cr\noalign{\hfil}\unvbox\TestBox\cr}}%
  1600.    }%
  1601.   \global\setbox0=\null}
  1602. \newbox\LeftHalf
  1603. \newdimen\HalfWd
  1604. \HalfWd=\twocolcolwd
  1605. \advance\HalfWd by-\normalparindent
  1606. \divide\HalfWd by 2
  1607. {\obeylines
  1608. \gdef\twouplist #1{%
  1609.   \topskip=\baselineskip \splittopskip=\topskip
  1610.   \begingroup \parindent=\z@ \obeylines
  1611. %                       next line ends with intentional <cr>
  1612.   \def\endtwouplist{
  1613.     \egroup %               % end of \vbox
  1614.     \endgroup %             % end of \obeylines group
  1615.     \twosplit }%
  1616.   \global\setbox\TestBox=\vbox\bgroup\hsize=\HalfWd %
  1617.     \indent\vrule height\topskip width \z@ #1}%
  1618. %  Tags for special formatting of editor's notes  (See also TUGBOAT.COM)
  1619. \def\Editor{\noindent To the Editor:\par}
  1620. \def\EdNote #1{%
  1621.   \if #1[\unskip\hskip1em [\thinspace\xEdNote\ignorespaces
  1622.   \else \ifFirstPar \else \medskip\noindent \fi
  1623.   \xEdNote #1\fi }
  1624. %       Draw a box around a whole page, e.g. announcements page;
  1625. %       format must be \onenarrow or \onemedium, and start on a new page.
  1626. \def\bigbox{\hrule \hbox\bgroup \vrule\kern 1pc
  1627.         \vbox\bgroup \vskip 1pc }
  1628. \def\endbox{\endgraf \vskip 1pc \egroup \kern 1pc\vrule \egroup \hrule }
  1629. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1630. %     *****  initialization  *****
  1631. \def\initializearticle{%
  1632.   \let\thetitle=\relax
  1633.   \authornumber=0
  1634.   \def\@signature{\@defaultsignature}%
  1635.   \def\@authorlist{\@defaultauthorlist}%
  1636.   \@allowspanningfigstrue
  1637. \makeother\@
  1638. %               @ is prohibited in AMS-TeX, but should not be in TUGboat
  1639. \twocol
  1640. \maxcols=2
  1641. \OverlaysinTeXtrue
  1642. \Trimmarksfalse
  1643. \PrelimDrafttrue
  1644. \initializearticle
  1645. \pageno=1001                    % number of title page
  1646. \StretchyTenPointSpacing
  1647. \StretchyNinePointSpacing
  1648. \StretchyEightPointSpacing
  1649. \makevertverbchar
  1650. \endinput
  1651. %  History of changes
  1652. Version   Date        Changes
  1653. -------   ---------   ---------------------------------------------------
  1654. 1.06      13 May 90   Added \@setupverbwrite to eliminate initial ^^M
  1655.                       as \verbatim writes to a file.
  1656.                       Made strut on first line of footnote slightly taller
  1657.                       so as to separate footnotes.
  1658. 1.05      23 Apr 90   Added "\setupverbatim" to \@firstverbchar so
  1659.                       that category switches are accomodated properly.
  1660. 1.04       7 Mar 90   Added \colsepwidth to allow for separation between
  1661.                       columns of lists
  1662. 1.03       1 Mar 90   Modified \@dosubhead and \@dosubsubhead to allow
  1663.                       stretchable space afterward
  1664. 1.02      25 Feb 90   Added \resetmaxcols to allow for automatic adjustment
  1665.                       of \maxcols; if overlays are done by the driver,
  1666.                       \maxcols needs to be set to an overall job maximum
  1667.                       at the start of the job.
  1668.                       Added setting of \SecTitletrue to definition
  1669.                       of \sectitle.
  1670.                       Added indicator of style file loaded (\tubstyle).
  1671. 1.01      17 Jan 90   Modified \@executetoend so that \@next would not
  1672.                       be clobbered by \csname @begin\CurrentTag\endcsname;
  1673.                       \@next changed to \@afterbegintag
  1674.                       Added `\the' before \@otherSFD within definition of
  1675.                       \@shortparse
  1676.                       added \@altdisplaystyle to definition of \colsep
  1677.